package com.easy.api.factory.file;

import org.springframework.beans.factory.FactoryBean;

/**
 * @Author liuyuan
 * @Date 2020/5/3 1:16 下午
 * @Version 1.0
 */
public class FileConversionFactory<T> implements FactoryBean<T> {
    private Class<?> interfaceClass;

    public Class<?> getInterfaceClass() {
        return interfaceClass;
    }

    public void setInterfaceClass(Class<?> interfaceClass) {
        this.interfaceClass = interfaceClass;
    }

    @Override
    public T getObject() throws Exception {
        return (T)new FileInvocationProxy().bind(interfaceClass);
    }

    @Override
    public Class<?> getObjectType() {
        return interfaceClass;
    }

    @Override
    public boolean isSingleton() {
        return true;
    }
}
